package com.ruoqing.log.test;

import java.util.Scanner;

/**
	* @author YaoXian
	* @title: test
	* @projectName ruoxi-blog
	* @description: 若兮微服务 -
	* @date 2020-12-16 13:11
	*/
public class test {
		public static void main(String[] args){
				Scanner sc = new Scanner(System.in);
				while(sc.hasNextLine()){
						int a,b,c;
						String[] input1 = sc.nextLine().split(" ");
						String[] input2 = sc.nextLine().split(" ");
						a = Integer.parseInt(input1[0]);
						b = Integer.parseInt(input1[1]);
						c = Integer.parseInt(input1[2]);
						int [] num = new int[a];
						int length = num.length;
						for(int i=0;i<a;i++){
								num[i] = Integer.parseInt(input2[i]);
						}
						int [][] dp = new int[length+1][length+1];
						int result = 0;
						for(int i = 0;i<c;i++){
								int count = 0;
								for(int j = 0;j<length - i;j++){
										if(i==0 && num[j]<=b){
												dp[j][j] = num[j];count+=1;
										}else{
												dp[j][j] = b+1;
										}
										if(dp[j+1][j+i] <= b - num[j]){
												dp[j][j+i] = dp[j+1][j+i] + num[j];count+=1;
										}else{
												dp[j][j+i] = b+1;
										}
								}
								result = count;
						}
						System.out.println(result);
				}
		}
		
		public static String longestPalindrome(String s) {
				int length = s.length();int maxIndex = 0; int minIndex = 0;
				boolean [][] dp = new boolean[length][length];
				dp[0][0] = true;
				for(int i = 1;i<length;i++){
						dp[i][i] = true;
						for(int j = 0;j<length - i;j++){
								if (!dp[j][j])dp[j][j]=true;
								if(i == 1 && s.charAt(j) == s.charAt(j+i)){
										dp[j][j+i] = true;
										maxIndex = j+i;minIndex = j;
								}
								if(dp[j+1][j+i-1] && s.charAt(j) == s.charAt(j+i)){
										dp[j][j+i] = true;
										maxIndex = j+i;minIndex = j;
								}
						}
				}
				
				return s.substring(minIndex,maxIndex+1);
		}
}
